﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using IBatisNet.DataMapper;
using uIBTvFace;
using DevExpress.XtraTreeList;
using DevExpress.Utils.Drawing;

namespace uIBTvFace.UserInterface
{
    public partial class RexFrm_UngVien : DevExpress.XtraEditors.XtraForm
    {
        uIBTvFace.Servicess.Service ws;

        public RexFrm_UngVien()
        {
            InitializeComponent();
            ws = new uIBTvFace.Servicess.Service();
            trl_BoPhan.DataSource = ws.GetBophanVitri();
            
         //   trl_BoPhan.IndicatorWidth = 40;
        }
    
        private void RexFrm_UngVien_Load(object sender, EventArgs e)
        {
            
            
            
        }

        private void trl_BoPhan_CustomDrawNodeIndicator(object sender, DevExpress.XtraTreeList.CustomDrawNodeIndicatorEventArgs e)
        {
            TreeList tmp = sender as TreeList;
            IndicatorObjectInfoArgs arg = e.ObjectArgs as IndicatorObjectInfoArgs;

            if (arg != null)
            {
                int row = tmp.GetVisibleIndexByNode(e.Node) + 1;
                tmp.IndicatorWidth = row.ToString().Length * 10 + 10;
                arg.DisplayText = row.ToString();
            }
        }

        
        private void trl_BoPhan_AfterFocusNode(object sender, NodeEventArgs e)
        {
            Guid id = new Guid(trl_BoPhan.FocusedNode.GetDisplayText("ID"));
            //uIBTv.Controller.UngVienController ss = new uIBTv.Controller.UngVienController();
            //grcMain.DataSource = ss.GetUngVienId(id);
            DataTable ds = new DataTable();
            ds = ws.GetUngVienId(id).Tables[0];
            grcMain.DataSource = ds;
        }
    }
}